# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=tealdeer
pkgver=1.6.1
pkgrel=2
pkgdesc="Very fast implementation of tldr in Rust"
url="https://dbrgn.github.io/tealdeer/"
arch="all"
license="MIT AND Apache-2.0"
makedepends="cargo openssl-dev cargo-auditable"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/dbrgn/tealdeer/archive/refs/tags/v$pkgver.tar.gz
	use-system-tls.patch
	"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/tldr -t "$pkgdir"/usr/bin/

	install -Dm644 completion/bash_tealdeer \
		"$pkgdir"/usr/share/bash-completion/completions/tldr
	install -Dm644 completion/fish_tealdeer \
		"$pkgdir"/usr/share/fish/vendor_completions.d/tldr.fish
	install -Dm644 completion/zsh_tealdeer \
		"$pkgdir"/usr/share/zsh/site-functions/_tldr
}

sha512sums="
2742e76fce794ffe98839b85b708a5b8452ec8f7b1b737ea522e4e1c37cdadff60ff95a5d353bde0cbdf57d00026ac71f065ea045d1435eb93c7a74d7c732af2  tealdeer-1.6.1.tar.gz
f7f0200d7d84b6533ba25c1456e9b3cf388f3bae43c4399705caeffae5497d2bf26c4826039a94fe356cbfa052346913ad6e3caee6fb2ca95abd2db682fa0bcd  use-system-tls.patch
"
